package com.ruoyi.coal.modules.coalpile.domain;

import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Calendar;
import java.util.Date;

@TableName("cp_coal_save_uses")
public class CpCoalsaveUses {
    int id;

    Date time;

    String name;

    String type;

    double number;

    int yardId;

    public String toString() {
        return "CpCoalsaveUses(id=" + getId() + ", time=" + getTime() + ", name=" + getName() + ", type=" + getType() + ", number=" + getNumber() + ", yardId=" + getYardId() + ")";
    }

    public boolean equals(Object o) {
        if (o == this)
            return true;
        if (!(o instanceof com.ruoyi.coal.modules.coalpile.domain.CpCoalsaveUses))
            return false;
        com.ruoyi.coal.modules.coalpile.domain.CpCoalsaveUses other = (com.ruoyi.coal.modules.coalpile.domain.CpCoalsaveUses)o;
        if (!other.canEqual(this))
            return false;
        if (getId() != other.getId())
            return false;
        Object this$time = getTime(), other$time = other.getTime();
        if ((this$time == null) ? (other$time != null) : !this$time.equals(other$time))
            return false;
        Object this$name = getName(), other$name = other.getName();
        if ((this$name == null) ? (other$name != null) : !this$name.equals(other$name))
            return false;
        Object this$type = getType(), other$type = other.getType();
        return ((this$type == null) ? (other$type != null) : !this$type.equals(other$type)) ? false : ((Double.compare(getNumber(), other.getNumber()) != 0) ? false : (!(getYardId() != other.getYardId())));
    }

    protected boolean canEqual(Object other) {
        return other instanceof com.ruoyi.coal.modules.coalpile.domain.CpCoalsaveUses;
    }

    public int hashCode() {
        int PRIME = 59;
        int result = 1;
        result = result * 59 + getId();
        Object $time = getTime();
        result = result * 59 + (($time == null) ? 43 : $time.hashCode());
        Object $name = getName();
        result = result * 59 + (($name == null) ? 43 : $name.hashCode());
        Object $type = getType();
        result = result * 59 + (($type == null) ? 43 : $type.hashCode());
        long $number = Double.doubleToLongBits(getNumber());
        result = result * 59 + (int)($number >>> 32L ^ $number);
        return result * 59 + getYardId();
    }

    public void setId(int id) {
        this.id = id;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setNumber(double number) {
        this.number = number;
    }

    public void setYardId(int yardId) {
        this.yardId = yardId;
    }

    public CpCoalsaveUses(int id, Date time, String name, String type, double number, int yardId) {
        this.id = id;
        this.time = time;
        this.name = name;
        this.type = type;
        this.number = number;
        this.yardId = yardId;
    }

    public CpCoalsaveUses() {}

    public int getId() {
        return this.id;
    }

    public Date getTime() {
        return this.time;
    }

    public String getName() {
        return this.name;
    }

    public String getType() {
        return this.type;
    }

    public double getNumber() {
        return this.number;
    }

    public int getYardId() {
        return this.yardId;
    }

    public int getYear() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(this.time);
        return calendar.get(1);
    }

    public LocalDate toLocalDate() {
        return this.time.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
    }
}

